package com.auto.base.util

import android.content.Context
import android.widget.Toast
import com.auto.base.net.ResultWrapper
import kotlin.coroutines.CoroutineContext


object ToastUtils {

    fun showShort(context: Context, message: String?) {
        if (!message.isNullOrEmpty()) {
            Toast.makeText(context.applicationContext, message, Toast.LENGTH_SHORT).show()
        }
    }

    fun showLong(context: Context, message: String?) {
        if (!message.isNullOrEmpty()) {
            Toast.makeText(context.applicationContext, message, Toast.LENGTH_LONG).show()
        }
    }

    fun showNetError(context: Context, callback: ResultWrapper.Error) {
        val temp = callback.exception.message
        showShort(context, temp)
    }
}